<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 500px;
            height: 150px;
            border: 10px solid #333;

            display: flex;
            justify-content: space-evenly;
            align-items: center;

            margin: 30px auto;
            /* position: relative; */
        }

        p {
            width: 100px;
            height: 100px;
        }

        img {
            width: 100%;
            height: 100%;
            display: block;
        }

        span {
            position: fixed;
            /* top: 0;
                left: 0; */
            width: 288px;
            height: 180px;
            display: none;
        }
    </style>
</head>

<body>
    <div class="box">
        <p><img src="1.png" alt="" /></p>
        <p><img src="2.png" alt="" /></p>
        <p><img src="3.png" alt="" /></p>
        <span>
            <img src="1.png" alt="" />
        </span>
    </div>

    <script src="../jquery/jquery-3.6.0.js"></script>

    <script>
        $("p>img")
            .hover(
                function (e) {
                    const src = $(this).attr("src")

                    $("span")
                        .css({ display: "block" })
                        .find("img")
                        .attr("src", src)
                },

                function (e) {
                    $("span").css("display", "none")
                }
            )

            .mousemove(
                function (e) {
                    $("span")
                        .offset({
                            left: e.pageX + 10,
                            top: e.pageY + 10
                        })
                }
            )
    </script>
</body>

</html>